package com.warehouse_management.purchase.service;

/**
 * @PACKAGE_NAME: com.warehouse_management.purchase.service
 * @NAME: PurchaseService
 * @USER: ZhouYongCheng
 * @DATE: 2022/10/3
 * @TIME: 2:53
 * @Description: 采购单管理控制层
 */

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.warehouse_management.config.PageModel;
import com.warehouse_management.purchase.model.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface PurchaseService extends IService<Details> {

    /**
     * 查询采购单
     * 周永成
     * @return
     */
    public PageModel<Purchase> queryPurchaseList(String CaiGouDan,
                                                 String CaiGouFTime,
                                                 String CaiGouLTime,
                                                 String FMoneny,
                                                 String LMoneny,
                                                 String ShengHe,
                                                 PageModel<Purchase> pageModel);

    /**
     * 查询用户名
     * 周永成
     * @param id 用户id
     * @return
     */
    public String queryUserByName(String id);


    /**
     * 周永成
     * 查询所有品牌
     * @return
     */
    public List<Brand> queryBrandList();

    /**
     * 周永成
     * 更具品牌查询类型集合
     * @return
     */
    public List<Type> queryTypeList(String brandId);

    /**
     * 周永成
     * 根据类型查询商品集合
     * @param typeId
     * @return
     */
    public List<Product> queryProductList(String typeId);

    /**
     * 周永成
     * 查询厂商
     * @return
     */
    public List<Firm> queryFirmList(String productId);

    /**
     * 采购单Purchase插入
     * @return
     */
    public Boolean insertPurchase(Purchase purchase);

    /**
     * 采购单Details插入
     * @return
     */
    public Boolean insertDetails(Details details);

    /**
     * 根据商品id获取单价
     * @param productId     商品id
     * @return
     */
    public String getProductPrice(String productId);

    /**
     * addPurchase分发插入
     * @return
     */
    public int FenFaInsert(List<Purchase> purchase,List<Details> details);


    /**
     * 根据用户名查询用户id
     * @param userName
     * @return
     */
    public String getUserID(@Param("userName") String userName);


    /**
     * 周永成
     * 根据采购单号查询C_DETAILS并回写数据
     * @param purchaseId
     * @return
     */
    public List<Details> queryDetailsByPurchase(String purchaseId);


    /**
     * 根据采购单查询采购详细
     * @param purchaseId
     * @return
     */
    public Purchase queryPurchase(@Param("purchaseId") String purchaseId);
}
